package kz.simplex.photobox.security;

import java.util.Random;

import org.jboss.seam.annotations.Create;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.captcha.Captcha;
import org.jboss.seam.captcha.CaptchaResponse;

@Name("org.jboss.seam.captcha.captcha")
public class SubtractCaptcha extends Captcha {
	
	@Override
	@Create
	public void init() {
		Random random = new Random(1234567890);
		int firstNum = random.nextInt(100);
		int secondNum = random.nextInt(100);
		this.setChallenge(firstNum + "-" + secondNum);
		this.setCorrectResponse(""+(firstNum - secondNum));
	}
	
	@Override
	@CaptchaResponse(message = "Math isn't your strong point is it?")
	public String getResponse() {
		return super.getResponse();
	}
}
